package com.dongdongshop.controller;

import com.dongdongshop.data.Result;
import com.dongdongshop.enums.ResultEnums;
import com.dongdongshop.pojo.TbItemCat;
import com.dongdongshop.service.TbItemCatService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("TbItemCat")
public class TbItemCatController {

    //注入service
    @DubboReference
    private TbItemCatService tbItemCatService;

    //查询分类数据
    @ResponseBody
    @RequestMapping("TbItemCatshow")
    public Result tbItemCatshow(Long parentId) {
        try {
            List<TbItemCat> list = tbItemCatService.tbItemCatshow(parentId);
            return Result.response(ResultEnums.SHOW_SUCCESS).setData(list);
        } catch (Exception e) {
            return Result.response(ResultEnums.SHOW_ERROR);
        }
    }

}
